package com.cdtye.shuoh.controller.rule;

import com.cdtye.common.webcore.web.AjaxJson;
import com.cdtye.shuoh.domain.rule.entity.RuleAlarmList;
import com.cdtye.shuoh.domain.rule.vo.RuleAlarmListVo;
import com.cdtye.shuoh.service.rule.RuleAlarmListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 报警Controller
 * @author ZhongWang Wang
 * @date 2022-12-21
 */

@RestController
@RequestMapping("/ruleAlarmList")
public class RuleAlarmListController {
    @Autowired
    private RuleAlarmListService alarmListService;

    /**
     * 分页查询
     * @param vo
     * @return
     */
    @PostMapping("/pageList")
    public AjaxJson pageList(@RequestBody RuleAlarmListVo vo){
        return AjaxJson.success(alarmListService.pageList(vo));
    }

    /**
     * 列表获取
     * @param vo
     * @return
     */
    @PostMapping("/list")
    public AjaxJson list(@RequestBody RuleAlarmListVo vo){
        return AjaxJson.success(alarmListService.list(vo));
    }

    /**
     * 插入预警信息
     * @param alarmList
     */
    @PostMapping("/insertAlarmInfo")
    public void insertAlarmInfo(@RequestBody RuleAlarmList alarmList){
         alarmListService.insertAlarmInfo(alarmList);
    }

    @GetMapping("/dataStatistic")
    public AjaxJson dataStatistic(){
        return AjaxJson.success(alarmListService.dataStatistic());
    }

    @GetMapping("/timeStatistic")
    public AjaxJson timeStatistic(){
        return AjaxJson.success(alarmListService.timeStatistic());
    }

}
